package pattern.observer;

public class Test {
    public static void main(String[] args) {
        Product product = new Product();
        Agent1 agent1 = new Agent1();
        Agent2 agent2 = new Agent2();

        product.addObserver(agent1);
        product.addObserver(agent2);

        product.setPrice(100);
        product.setPrice(200);
        System.out.println("代理商1的批发价：" + agent1.getPrice());
        System.out.println("代理商2的批发价：" + agent2.getPrice());
    }
}
